#ifndef CUSTOMVERTICALHEADER_H
#define CUSTOMVERTICALHEADER_H

#include <QTableView>
#include <QStandardItemModel>
#include <QHeaderView>
#include <QPainter>
#include <QMouseEvent>
#include <QIcon>
#include <QEvent>


// 自定义水平表头类
class CustomVerticalHeader : public QHeaderView {
public:
    explicit CustomVerticalHeader(Qt::Orientation orientation, QWidget* parent = nullptr);
    void setEditRow(int row);

protected:
    void paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const override;

    void mousePressEvent(QMouseEvent* event) override;
    void mouseMoveEvent(QMouseEvent* event) override;

    //void enterEvent(QEvent *event) override;

    void leaveEvent(QEvent *event) override;

    void paintEvent(QPaintEvent* event) override;

private:
    QIcon m_selectedIcon; // 被选中时显示的图标
    mutable int m_selectedSection; // 当前选中的表头部分
    int m_hoverSection = -1; // 当前悬停的表头部分
    int m_editSection = -1; // 编辑
};

#endif // CUSTOMVERTICALHEADER_H
